package demo05;

import java.util.ArrayList;
import java.util.Collections;
import java.util.List;
import java.util.function.Consumer;

/**
 * @author: WangPeng
 * @createTime: 2022/11/04 17:27
 * @description:
 * @version: v1.0
 */
public class Test02 {
    public static void main(String[] args) {
        List<String> list = new ArrayList<>();
        Collections.addAll(list, "张无忌", "周芷若", "赵敏", "张强", "张三丰");
//        Consumer<String> consumer = (a)->System.out.println(a);

        //先拿到lsit集合的stream流
        list.stream()
                //拿到姓张的
                .filter(a->a.startsWith("张"))
                //拿到姓张的且名字为三个字的
                .filter(a->a.length()==3)
                //输出
                .forEach(a-> System.out.println(a));
    }
}
